package com.glorystone.ins.common.util;

public final class RuleUtil {

    public static String checkpublic(String id, String modeble, String name, String cardid,String realname,String email){
          String newid =null;
          boolean verify =false;
          if(id.equals("FQZGZ0004")){
                verify = StringUtil.checkMobile(modeble);
                return checkpublicid(id,verify);
          }
          if(id.equals("FQZGZ0005")){
            verify = StringUtil.checkEmail(email);
            return checkpublicid(id,verify);
          }
          if(id.equals("FQZGZ0002")){
              verify = IdcardValidatorUtil.getChecksub(cardid);
              return checkpublicid(id,verify);
          }
          if(id.equals("FQZGZ0001")){
            verify = IdcardValidatorUtil.isValidatedAllIdcard(cardid);
            return checkpublicid(id,verify);
          }
          if(id.equals("FQZGZ0007")){
              int cardnew = IdcardValidatorUtil.getAgeByIdCard(cardid);
              if(cardnew<18){
                  verify = false;
              }
              return checkpublicid(id,verify);
          }
          if(id.equals("FQZGZ0006")){
              int cardnew = IdcardValidatorUtil.getAgeByIdCard(cardid);
              if(cardnew>40){
                  verify = false;
              }
              return checkpublicid(id,verify);
          }
          else{
              return newid;
          }

    }
     public static String checkpublicblack(String id) {
         String newid = null;
         boolean verify = false;
         if (id.equals("FQZGZ0008")) {
             return checkpublicid(id, verify);
         }
         if (id.equals("FQZGZ0009")) {
             return checkpublicid(id, verify);
         }
         if (id.equals("FQZGZ00010")) {
             return checkpublicid(id, verify);
         }
         else {
             return newid;
         }
     }
    public static String checkcontactname(String id){
        String newid =null;
        boolean verify =false;
        if(id.equals("FQZGZ00012")){
            return checkpublicid(id,verify);
        }
        else {
            return newid;
        }
    }

     public static String checkpublicid(String id,boolean verify){
         String newid =null;
         if(!verify){
             return newid =id;
         }
         return newid;
     }

}
